hysop.operator.base.redistribute_operator module

class hysop.operator.base.redistribute_operator.RedistributeOperatorBase(variable, source_topo, target_topo, components=None, name=None, pretty_name=None, **kwds)[source]

Bases: ComputationalGraphOperator

Abstract interface to redistribute operators.

Parameters:
  • variable (ScalarField) – the variable to be distributed

  • source_topo (Topology) – source mesh topology

  • target_topo (Topology) – target mesh topology

  • name (str, optional) – name of this operator

  • pretty_name (str, optional) – pretty name of this operator

available_methods()[source]

Returns the available methods of this node. This should return a dictionary of method as keys and possible values as a scalar or an iterable. See hysop.types.InstanceOf to support specific class types. This is used to check user method input.

abstract can_redistribute(source_topo, target_topo)[source]

Return true if this RedistributeOperatorBase can be applied to redistribute a variable from source_topo to target_topo, else return False.

default_method()[source]

Returns the default method of this node. Default methods should be compatible with available_methods. If the user provided method dictionnaty misses some method keys, a default value for this key will be extracted from the default one.

get_field_requirements()[source]

Called just after handle_method(), ie self.method has been set. Field requirements are:

  1. required local and global transposition state, if any.

  2. required memory ordering (either C or Fortran)

Default is Backend.HOST, no min or max ghosts, MemoryOrdering.ANY and no specific default transposition state for each input and output variables.

get_node_requirements()[source]

Called after get_field_requirements to get global operator requirements.

By default we enforce unique:

*transposition state *cartesian topology shape *memory order (either C or fortran)

Across every fields.

get_preserved_input_fields()[source]

Declare fields that should not be invalidated as a set. You can only declare scalar fields that are input and output fields at the same time. For example, a redistribute operation does not invalidate input fields.

handle_method(method)[source]

Method automatically called during initialization. This allow to extract method values after method preprocessing. Method preprocessing means:

  1. complete user input with compatible top graph user inputs

  2. complete the resulting dictionnary with the node default_method

  3. check method against available_methods.

The result of this process is fed as argument of this function.

initialize(topgraph_method=None, **kwds)[source]

Initialize this node.

Initialization step sets the following variables:

*self.method, *self.input_field_requirements *self.output_field_requirements *self.initialized

It returns self.method.

Order of execution is:

self.pre_initialize() self._setup_method() self.handle_method() self.get_field_requirements() self._initialized = True self.post_initialize()

See ComputationalGraphNode.handle_method() to see how user method is handled. See ComputationalGraphNode.get_field_requirements() to see how topology requirements are handled.

After this method has been handled by all operators, initialization collects min and max ghosts required by each operators which will be usefull in the discretiezation step to automatically build topologies or check against user supplied topologies.

This function also sets the self.initialized flag to True (just before post initialization). Once this flag is set one may call ComputationalGraphNode.discretize().

classmethod supported_backends()[source]

return the backends that this operator’s topologies can support.

classmethod supports_mpi()[source]

Return True if this operator was implemented to support multiple mpi processes.

classmethod supports_multiple_field_topologies()[source]

Should return True if an input field that is also an output field can have an input topology different from its output topology. This is usefull in Redistribute like operators. If this returns True this implies supports_multiple_topologies(). It also implies that self.variables[field] may return a set of topologies. In this case one can recover input and output topologies by using self.input_fields[field] and self.output_fields[field]. In addition one can find such fields by using the list self.multi_topo_fields which is set after ComputationalGraphNode.initialize() has been called.

classmethod supports_multiple_topologies()[source]

Should return True if this node supports multiple topologies.